/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 80027
 Source Host           : localhost:3306
 Source Schema         : permission

 Target Server Type    : MySQL
 Target Server Version : 80027
 File Encoding         : 65001

 Date: 28/03/2022 16:26:39
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for menu
-- ----------------------------
DROP TABLE IF EXISTS `menu`;
CREATE TABLE `menu` (
  `menu_id` int NOT NULL AUTO_INCREMENT,
  `menu_name` varchar(255) NOT NULL,
  `url` varchar(255) NOT NULL,
  `permission` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`menu_id`)
) ;

-- ----------------------------
-- Records of menu
-- ----------------------------
BEGIN;
INSERT INTO `menu` VALUES (1, '添加用户', '/users/add', 'users:add');
INSERT INTO `menu` VALUES (2, '修改用户', '/users/edit', 'users:edit');
INSERT INTO `menu` VALUES (3, '查看用户', '/users/info', 'users:info');
INSERT INTO `menu` VALUES (4, '添加分类', '/cate/add', 'cate:manager');
INSERT INTO `menu` VALUES (5, '编辑分类', '/cate/edit', 'cate:manager');
COMMIT;

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `role_id` int NOT NULL AUTO_INCREMENT,
  `role_name` varchar(255) NOT NULL,
  `remark` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`role_id`)
) ;

-- ----------------------------
-- Records of role
-- ----------------------------
BEGIN;
INSERT INTO `role` VALUES (1, 'admin', '超级管理员');
INSERT INTO `role` VALUES (2, 'user', '普通用户');
COMMIT;

-- ----------------------------
-- Table structure for role_menu
-- ----------------------------
DROP TABLE IF EXISTS `role_menu`;
CREATE TABLE `role_menu` (
  `role_id` int DEFAULT NULL,
  `menu_id` int DEFAULT NULL
) ;

-- ----------------------------
-- Records of role_menu
-- ----------------------------
BEGIN;
INSERT INTO `role_menu` VALUES (1, 1);
INSERT INTO `role_menu` VALUES (1, 2);
INSERT INTO `role_menu` VALUES (1, 3);
INSERT INTO `role_menu` VALUES (1, 4);
INSERT INTO `role_menu` VALUES (2, 3);
INSERT INTO `role_menu` VALUES (1, 5);
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `user_id` int NOT NULL AUTO_INCREMENT,
  `user_name` varchar(255)  NOT NULL,
  `password` varchar(255) NOT NULL,
  `status` int DEFAULT NULL,
  PRIMARY KEY (`user_id`) USING BTREE
) ;

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES (1, 'admin', '$2a$10$k57Fwqeo1wZA4hjfVjKpCOmRLRaViWz1Cl3uckBP7tRgEaSnkulRq', 1);
INSERT INTO `user` VALUES (2, 'zhangsan', '$2a$10$XeAXDw3ToOjxARUmNOnS2OxmTbjSrWTGCrbCRKFROK8dkHVeP/the', 1);
INSERT INTO `user` VALUES (3, 'lisi', '$2a$10$6/m5CBZkDGrGdbPSzJ0ld.AJytPzVPQCgLO.MDT8NA5vucYHm2r.6', 0);
INSERT INTO `user` VALUES (4, 'wangwu', '$2a$10$T/KtYNVLZfe39cWuySljGOJOysb9eQVi2ldudloAtyKKpi5aAMAsm', 2);
INSERT INTO `user` VALUES (5, 'zhaoliu', '$2a$10$Y2UXysEQnlcGEXa4yTDn3u6nkroQ.8C5.KIse5K.TRLfmFh5Quf3K', 1);
COMMIT;

-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role` (
  `user_id` int DEFAULT NULL,
  `role_id` int DEFAULT NULL
) ;

-- ----------------------------
-- Records of user_role
-- ----------------------------
BEGIN;
INSERT INTO `user_role` VALUES (1, 1);
INSERT INTO `user_role` VALUES (2, 2);
INSERT INTO `user_role` VALUES (3, 2);
INSERT INTO `user_role` VALUES (4, 1);
INSERT INTO `user_role` VALUES (5, 2);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
